<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.js"></script>
	</head>

	<body>
	</body>

</html>

<script type="text/javascript">
	var obj = new Promise(function(resolve, reject) {
		var url = 'https://www.easy-mock.com/mock/5b67edb475d70b78bbc6212e/xinyan/getFoodList';
		var data = {type: 'fruit'};
		$.ajax({
			type: "get",
			url,
			success: (res) => {
				resolve(res);
			},
			error: (err) => {
				reject('请求失败');
			}
		});
	})
	
	obj.then(function(res) {
		console.log(res);
	}).catch(function(err) {
		console.log(err);
	})
	
</script>